let mongoose = require('mongoose'),
    categorys = mongoose.model('categorys');

module.exports = (req, res) => {
    let params = req.body,
        saveData = new categorys({categorys: params});

    // 防止用户误操作，不删除原有数据，将新数据进行保存
    saveData.save(err => {
        if(err){
            res.json(resFail(err))
        }else{
            res.json({
                result: 1,
                data: {success: '保存成功！'}
            })
        }
    })
}